package com.changgou.goods.dao;

import com.changgou.goods.pojo.Category;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;

public interface CategoryMapper extends Mapper<Category> {

    //查询所有一级菜单
    @Select("SELECT * FROM tb_category WHERE parent_id = '0'")
    public List<Category> findByStair();

    //根据菜单id查询对应子菜单
    @Select("SELECT * FROM tb_category WHERE parent_id = #{id}")
    public List<Category> findByMenu(@Param("id") Integer id);

}
